function isJSON(str) {
	if(typeof str == 'string') {
		try {
			var obj = JSON.parse(str);
			if(typeof obj == 'object' && obj) {
				return true;
			} else {
				return false;
			}

		} catch(e) {
			return false;
		}
	}
}
var localStorageFunc = {
	set: function(key, value) {
		if(typeof value == 'string') {
			localStorage.setItem(key, value);
		} else {
			localStorage.setItem(key, JSON.stringify(value));
		}
	},
	get: function(key) {
		var str = localStorage.getItem(key);
		if(isJSON(str)) {
			return JSON.parse(str);
		} else {
			return undefined;
		}

	}
};